<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-02 19:42:06
 * @LastEditTime: 2023-07-08 13:43:16
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Repositories;


use App\Models\MpcLocation;
use Illuminate\Http\Request;

class MpcLocationRepository extends Repositories
    {
    protected $relation_models = ['parent', 'creator', 'updator', 'admin', 'department'];
    public function boot(MpcLocation $model)
        {
        $this->model = $model;
        }

    public function fuzzySearch($value)
        {
        $value = trim($value);
        $this->where(function ($query) use ($value)
            {
            $query->orWhere("name", "like", "%{$value}%");
            $query->orWhere("code", "like", "%{$value}%");
            });
        }
    }